/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ChateoFacadeGUI;

import ChateoController.*;
import ChateoGUI.*;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.ArrayList;
/**
 *
 * @author adrian
 */
public class FacadeGUI {
    private Controller controller;
    private ChatGUI gui;
    
    public FacadeGUI(Controller father){
        this.controller=father;
        //ChatGUI connect=new ChatGUI(this);
    }
    
    /**
     * 
     * GUI --> Controller
     * 
     */
    
    
    
    /**
     * This method is the connexion interface between the GUI and the System
     * @param login
     * @param port
     * @throws NullPointerException
     * @throws SocketException
     * @throws UnknownHostException 
     */
    public void processConneccion(String login) throws NullPointerException, SocketException, UnknownHostException{
        controller.connectFromGUI(login);
    }
    
    public void processDisconneccion() throws UnknownHostException, SocketException{
        controller.disconnect();
    }
    
    public void sendPublicMessage(){
        
    }
    
    public void sendPrivateMessage(User currentUser,String msg2Snd) throws SocketException, UnknownHostException{
        controller.sendMessage(currentUser,msg2Snd,true);
    }
    
    public void sendFile(){
        
    }
    
    public void acceptFile(){
        
    }
    
    public void refuseFile(){
        
    }
    
    public void cancelFile(){
        
    }
    
        
        
    /**
     * 
     * Controller --> GUI
     * 
     */
    
    /*public void updateUsers(UsersList userList, ArrayList<ChatMessage> messageList){
        
    }*/
    
    public void updateGUI(ArrayList<User> userList,ArrayList<ChatMessage> messageList){
        gui.updateFullGUI(userList,messageList);
    }
    
    public void updateUsers(ArrayList<User> userList){
        gui.updateUsers(userList);
    }
        
    public void updateMessages(ArrayList<ChatMessage> messageList){
        
    }
    
    public void updateTransfer(){
        
    }
    
    public void updateGUIafterConnection(ArrayList<User> userList){
        gui.updateUsers(userList);
        
    }

    public void updateGUIafterDisconnection(){
        
    }

    public void setGui(ChatGUI gui) {
        this.gui = gui;
    }

    
    
}
